<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws.
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.).
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations).
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Account/classes/PhpFox_ComponentMemberSnoop.class.php, $Author:  $ */



/** User settings
 *
 * Parameters:
 *  1. oUser (required) - user account object
 *
 * @package module.account
 * @version $Id: PhpFox_ComponentMemberSnoop.class.php 46 2007-12-14 23:12:21Z phpfoxsv $
 *
 */
class PhpFox_Mod_Account_ComponentMemberSnoop extends BaseComponent
{
    /** Processing method
     */
	function process()
	{

	    $oReq = &App::getRequest();
	    $bLoggedId = false;

	    switch($oReq->getAction())
	    {
	        case 'member_snoop':
	            $oSrvSec = $this->_oModule->getService('Security');
	            /* @var $oSrvSec PhpFox_Mod_Account_ServiceSecurity */
	            $oAcc = $oSrvSec->getUserByName($oReq->get('user'));
	            if ($oAcc)
	            {
    	            if ($oSrvSec->loginByAdmin($oAcc->aData[$oAcc->sId]))
    	            {
    	                $bLoggedId = true;
    	            }
    	            else
    	            {
    	                $this->addErrors($oSrvSec->getErrors());
    	            }
        	    }
	            else
	            {
	                $this->addErrors(App::format('Mod_Account.error.login'));
	            }
	            break;
	    }

	    $oTpl = &$this->_oModule->getTemplate();
	    /* @var $oTpl Template */
	    $oTpl->assignSrc(array(
	    	'aErrors'   => $this->getErrors(),
		    'bLoggedId' => $bLoggedId,
	    ));

	    $srcHtml = $oTpl->fetch('MemberSnoop.html');


	    return $srcHtml;
	}
}
?>